public OnPlayerText(playerid, text[]) {    
    if(playerData[playerid][isMuted] && text[0] != '!') {
		SendClientMessage(playerid, C_RED, "* Error: You have been muted and aren't able to use the global chat anymore.");
		return false;
	}
	
	new szColor[16];
	format(szColor, 16, "%04x%04x", GetPlayerColor(playerid) >>> 16, GetPlayerColor(playerid) & 0xFFFF);
	
	if(strlen(szColor) > 6) {
		strdel(szColor, strlen(szColor) - 2, strlen(szColor));
	}
	
	if(text[0] == '#') {
		if(playerData[playerid][level] < LEVEL_MOD) {
			return true;
		}
		
		SendFormattedMessageToAll(C_RED, "* %s -> %s", CPlayer::getName(playerid), text[1]);
		return false;
	}
	
	if(text[0] == '!') {
		loop_players(i) {
			if((playerData[playerid][team] == TEAM_HOME || playerData[playerid][team] == TEAM_HOME_SUB) && (playerData[i][team] == TEAM_HOME || playerData[i][team] == TEAM_HOME_SUB)) 
				SendFormattedMessage(i, C_WHITE, "[%d] {%s}%s{FFFFFF}:{0AE2FA} %s", playerid, szColor, CPlayer::getName(playerid), text[1]);
			
			if((playerData[playerid][team] == TEAM_AWAY || playerData[playerid][team] == TEAM_AWAY_SUB) && (playerData[i][team] == TEAM_AWAY || playerData[i][team] == TEAM_AWAY_SUB)) 
				SendFormattedMessage(i, C_WHITE, "[%d] {%s}%s{FFFFFF}:{0AE2FA} %s", playerid, szColor, CPlayer::getName(playerid), text[1]);
			
			if(playerData[playerid][team] == TEAM_REF && playerData[i][team] == TEAM_REF) 
				SendFormattedMessage(i, C_WHITE, "[%d] {%s}%s{FFFFFF}:{0AE2FA} %s", playerid, szColor, CPlayer::getName(playerid), text[1]);
		}

		return false;
	}
	
	if(text[0] == '@') {
		loop_players(i) {
			if(playerData[i][level] >= LEVEL_MOD) 
				SendFormattedMessage(i, C_WHITE, "[%d] {%s}%s{FFFFFF}:{FFFF00} %s", playerid, szColor, CPlayer::getName(playerid), text[1]);
		}
		
		return false;
	}
			
	SendFormattedMessageToAll(C_WHITE, "[%d] {%s}%s{FFFFFF}: %s", playerid, szColor, CPlayer::getName(playerid), text);
	return false;	
}